package com.attilax.text;

import java.util.List;

import com.attilax.io.filex;
import com.attilax.util.numUtil;

public class ArticleTitleCapt {

	public static void main(String[] args) {
		char c='5';
		//System.out.println(numUtil.isNum(c));
		String f="c:\\a.txt";
		int lev=2; //defalt
		List<String> li=filex.read2list_filtEmptyNstartSpace(f, "utf8");
		for (String l : li) {
			if(l.contains("SNS基本概念"))
				System.out.println("dbg");
			if(l.trim().startsWith("第"))
			{
			System.out.println(l);
			continue;
			}
			
			l=l.trim();
			l=l.replace("．", ".");
			int lv=readLev(l);
			if(lv>0 && lv<=lev )
				System.out.println(l);
			
		}
	}

	private static int readLev(String l) {
		if(!l.contains("."))
			return 0;
		if(l.contains("¥"))// ius price
			return 0;
		if(l.contains("%"))// ius price
			return 0;
		
		char[] ca=l.toCharArray();
		char first=ca[0];
//		if(!numUtil.isNum(first) )
//			return 0;
		int lev = 0;
		String stat="ini";
		for (char c : ca) {
			if(numUtil.isNum(c) &&  (stat.equals("ini")|| stat.equals("dot"))  ) //
			{
				stat="num";
				 lev++;
			}
			if(c=='.')
			{
				stat="dot";
				//lev++;
			}
		//	if( numUtil.isNum(c) && stat.equals("ini"))
			
		}
		return lev;
	}

}
